<template>
	<view class="content">

		<image class="img_header" :src="avatar"></image>

		<view class="u_name">{{nickname || '安装人员'}}</view>

		<view class="u_name">{{tel || '--'}}</view>

		<view class="btn_ok" @click.stop="onOk">退出登录</view>

	</view>
</template>

<script>
	import { getUInfo } from '@/util/util.js'
	export default {
		data() {
			return {
				nickname: '',
				tel: '',
				// avatar: '/static/ic_header.png',
				avatar: '/static/ic_login_logo.jpg',
			}
		},

		onLoad() {
			let that = this

			this.nickname = getUInfo().nickname
			this.tel = getUInfo().tel
			// this.avatar = getUInfo().avatar

		},

		methods: {
			onOk() {
				// uni.showToast({ title: '退出登录', icon: 'none' })

				uni.showModal({
					title: '提示',
					content: '是否退出登录？',
					success: res => {
						if (res.confirm) {
							uni.removeStorageSync('userinfo')
							uni.redirectTo({ url: '/pages/login/login' })
						}
					}
				})

			}
		}
	}
</script>

<style scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.img_header {
		width: 160rpx;
		height: 160rpx;
		margin: 100rpx 0 0 0;
		border-radius: 888rpx;
	}

	.u_name {
		font-size: 30rpx;
		margin: 20rpx 0 0 0;
	}

	.btn_ok {
		background-color: deepskyblue;
		width: 500rpx;
		height: 66rpx;
		line-height: 66rpx;
		color: white;
		text-align: center;
		font-size: 30rpx;
		margin: 40rpx 0 0 0;
		border-radius: 888rpx;
	}
</style>